/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package expression;

import core.Node;
import core.UnsatException;
import domain.Domain;

/**
 *
 * @author ddoose
 */
public class Variable extends IntExpr {
    private String name;
    
    public Variable(Node c, String n) {
        super(c);
        name = n;
        current = Domain.UNIVERSE;
        target = Domain.UNIVERSE;
    }
    
    public boolean same(IntExpr i) {
        if (i instanceof Variable) {
            return name.equals(((Variable)i).name);
        }
        
        return false;
    }
    
    public String getName() {
        return name;
    }
    
    public void propagate() throws UnsatException {
        reduceCurrent(target);
    }
    
    public void eval() throws UnsatException {
    }
 
    public boolean reduce() {
        return false;
    }
    
    public Variable clone(Node n) {
        Variable v = new Variable(n, name);
        v.clone(this);
        return v;
    }
    
    public String toString() {
        return name;
    }
    
    public String pretty() {
        return id + "\t" + name + " = " + current + "\t" + target;
    }
}
